package com.qf.controller;

import com.qf.entity.Address;
import com.qf.service.IAddressService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RequestMapping("*")
@RestController()
@CrossOrigin("*")
public class AddressController {

    @Autowired
    private IAddressService iAddressService;

    @RequestMapping("/selectByUid/{uId}")
    public Address selectByUid(@PathVariable("uId")int uId){
        return iAddressService.selectByUid(uId);
    }

    @RequestMapping("/selectAddress/{uId}")
    public List<Address> selectAddress(@PathVariable("uId")int uId){
        return iAddressService.selectAddress(uId);
    }

    @RequestMapping("/updateAddress/{aId}/{uId}")
    public int updateAddress(@PathVariable("aId")int aId,@PathVariable("uId")int uid){
        return iAddressService.updateAddress(aId,uid);

    }
}
